﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDIOrganizer
{
    public static class Int64ExtensionMethods
    {
        public static Position ToPosition(this Int64 i)
        {
            var result = Position.None;
            try
            {
                result = (Position)Enum.ToObject(typeof(Position), i);
            }
            catch { }

            // if there is an pException, _role.None (Initial Value) is returned
            return result;
        }

        public static TX To<TX>(this Int64 i)
        {
            try
            {
                var result = (TX)Enum.ToObject(typeof(TX), i);
                return result;
            }
            catch
            {
                return default(TX);
            }

        }
    }
}
